#ifndef AVIATION_RESERVATION_H
#define AVIATION_RESERVATION_H

#include <exception>

#include "flight.h"
#include "customer.h"

#include <boost/serialization/nvp.hpp>

namespace aviation
{

/// This class represents a reservation; that is, a pairing of a customer and a flight with a given status.
class Reservation
{
public:

	/// Status enumeration; allows us to keep track of what type of reservation this is.
	enum RESERVATION_STATUS
	{
		FIRST_CLASS,
		STANDARD_CLASS,
		WAITING_FIRST,
		WAITING_STANDARD
	};

	/// Default constructor; creates a reasonable default reservation.
	Reservation();
	/// Constructs a reservation from a flight, customer and reservationStatus.
	Reservation(const Flight& flight, const Customer& customer, const RESERVATION_STATUS reservationStatus);
	/// Copies one reservation from another.
	Reservation(const Reservation& other);
	/// Trivial destructor.
	~Reservation();

	/// Assigns the value of one reservation to another.
	Reservation& operator=(const Reservation& other);
	
	/// Equality comparison operator.
	/// \returns True if they are the same, or false if they are different.
	const bool operator==(const Reservation& other) const;
	/// Inequality comparison operator.
	/// \returns True if they are different, or false if they are the same.
	const bool operator!=(const Reservation& other) const;
	/// Strict weak ordering operator.
	/// \returns True if one is strictly less than another.
	const bool operator<(const Reservation& other) const;

	/// Returns the flight ID as an integer.
	const unsigned GetFlightID() const;
	/// Returns the customer ID as an integer.
	const unsigned GetCustomerID() const;

	// Returns the reservation status.
	const RESERVATION_STATUS GetReservationStatus() const;

	/// Serialization (file I-O) function.
	/// \param ar A boost::archive formatter type.
	/// \param version The file version.
	template <class Archive>
	void serialize(Archive& ar, unsigned int version);

private:

	unsigned m_flightID;
	unsigned m_customerID;
	unsigned m_reservationStatus;

};

template <class Archive>
void Reservation::serialize(Archive& ar, unsigned int version)
{
	ar & BOOST_SERIALIZATION_NVP(m_flightID);
	ar & BOOST_SERIALIZATION_NVP(m_customerID);
	ar & BOOST_SERIALIZATION_NVP(m_reservationStatus);
}

} // namespace aviation

#endif // AVIATION_RESERVATION_H